package com.chainyoung.component_tmperson.ui.mvp.model;


import com.chainyoung.common.appcommon.entity.RecieveAccount;
import com.chainyoung.common.appcommon.entity.UploadFile;
import com.chainyoung.common.bean.UserInfo;
import com.chainyoung.common.di.scope.ActivityScope;
import com.chainyoung.common.integration.IRepositoryManager;
import com.chainyoung.common.mvp.BaseModel;
import com.chainyoung.common.utils.RxUtils;
import com.chainyoung.common.utils.Utils;
import com.chainyoung.component_tmperson.api.PersonService;
import com.chainyoung.component_tmperson.base.PersonConfig;
import com.chainyoung.component_tmperson.ui.mvp.contract.AccountInfoContract;
import com.chainyoung.component_tmperson.ui.mvp.contract.UpdateUserInfoContract;

import java.util.Map;
import java.util.TreeMap;

import javax.inject.Inject;

import io.reactivex.Flowable;
import okhttp3.MultipartBody;
import okhttp3.RequestBody;

@ActivityScope
public class UpdateUserInfoModel extends BaseModel implements UpdateUserInfoContract.Model {

    @Inject
    UpdateUserInfoModel(IRepositoryManager repositoryManager) {
        super(repositoryManager);

    }




    @Override
    public Flowable<UserInfo> updataUserInfo(TreeMap<String, Object> map) {
        return mRepositoryManager.obtainRetrofitService(PersonService.class)
                .updateUserInfo(map)
                .compose(RxUtils.<UserInfo>handleResult());
    }

    @Override
    public Flowable<UploadFile> upLoadLogo(RequestBody params) {
        return mRepositoryManager.obtainRetrofitService(PersonService.class)
                .upLoadImage(params)
                .compose(RxUtils.<UploadFile>handleResult());
    }




}